package com.demo.rabbitmq.consumer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;

/**
 * 接收延时消息
 * 没有配置启动插件，不加载bean
 */
@ConditionalOnProperty(name = "spring.rabbitmq.extra.plugin.enable", havingValue = "true")
@Slf4j
@Service
public class PluginDirectDelayConsumer {

    @RabbitListener(id = "plugin_direct_delay_queue_1", queues = "plugin_direct_delay_queue")
    public void directExchange1(String content) {
        log.info("消费者1，消费消息内容：" + content);
    }

    @RabbitListener(id = "plugin_direct_delay_queue_2", queues = "plugin_direct_delay_queue")
    public void directExchange2(String content) {
        log.info("消费者2，消费消息内容：" + content);
    }

    @RabbitListener(id = "plugin_direct_delay_queue_3", queues = "plugin_direct_delay_queue")
    public void directExchange3(String content) {
        log.info("消费者3，消费消息内容：" + content);
    }
}
